-
-
Notifications
You must be signed in to change notification settings - Fork 227
feat: Support for recursive and circular references using lazy imports #670
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit adds support for recursive and circular references in object properties and additionalProperties, but not in allOf. The changes include: -Delayed processing of schema model properties -Cascading removal of invalid schema reference dependencies -Prevention of self import in ModelProperty relative imports -Prevention of forward recursive type reference errors in generated modules -Logging for detection of recursive references in allOf
Previous changes prevented models defined in array schemas from being built properly. This commit fixes that issue and adds support for recursive and circular references in array schema item objects, a behavior that was previously expected but not functioning correctly. This does not add support for recursive and circular references directly in an array schema's 'items' section. However, this feature would be functionally useless, so a warning is logged on detection.
…l quoting optional
Codecov Report
@@ Coverage Diff @@
## main #670 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 49 49
Lines 1800 1946 +146
==========================================
+ Hits 1800 1946 +146
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks for continuing this journey—this is the most challenging problem that's been solved for this project in a long time 😁. This approach looks good—it's complex, but this is the cleanest solution I've seen so far, and I think about as clean as it will ever get. Well done! I solved the 🥳 🎉 🙇 |
I figured out where that Not sure how to solve this without adding more complexity to selecting imports. |
@dbanty Thank you so much for the fast feedback and your help! Seems all required tests were added.
Seems autoflake has had this issue for several years. I suggest fixing it later since it doesn’t produce any troubles + there are several points to improve and may be better to do it centralized. Checks now are failing because of |
Looks like the locked version of pydantic has a vulnerability, |
Hello! Seems the review is required here to be merged. I didn't see how to request it explicitly. Just let me know if I should do something here. |
Yup, I think this is good to go, I’ve just been traveling pretty much nonstop since the last update 😅. This will make it into the next release though! 🎉 |
Continuation of #582. Seems, closes: #338, #466 Adds lazy imports to avoid circular import errors, which #582 has.
Not fully finished. I’d like to polish it after receiving feedback.
Instead of #636
todo:
pass
, which sometimes appears into_dict
method of model.TypeVar
)quoted
argument if this approach will be used.